.module-legend {
  width: 100%;
  bottom: 0;
  left: 0px;
  color: $dark;
  font-size: 13px;
  max-height: 75%;
  overflow: auto;
  padding: 0px 0 56px;
  z-index: 22;
  background: $white;
  @include transition(all 0.25s $easeInOutSine);
  @include transform(translate(0,100%));

  &.active{
    @include transform(translate(0,0));
  }

  @media (min-width: $br-mobileMap){
    width: 283px;
    top: 110px;
    bottom: auto;
    left: 35px;
    padding: 0;
    max-height: calc(100% - 310px);
    @include transform(translate(0,0));
  }

  .close{
    position: absolute;
    width: 34px;
    height: 34px;
    padding: 8px;
    top: 0;
    right: 0;
    display: block;
    z-index: 5;
    svg{
      stroke: $dark;
    }
    @media (min-width: $br-mobileMap){
      display: none;
    }
  }


  // @ul
  .categories{
    margin: 20px 0;
    &.divided{
      margin: 15px 0;
      @media (min-width: $br-mobileMap){
        margin: 0 0 20px;
      }
    }
    h2{
      padding: 10px 15px;
      margin: 0 0 15px;
      background: #F0F0F0;
      font-weight: 500;
      color: $dark;
      font-size: 14px;
      text-transform: uppercase;
      @media (min-width: $br-mobileMap){
        padding: 10px 20px;
      }
    }
    // @li
    .category {
      padding: 0 20px 25px;
      &.closed{
        padding: 0 20px 10px;
        .category-name {
          &:after{ @include transform(translate(0,-100%) rotate(180deg));}
          em{ display: inline-block;}
        }
      }
      &:last-child{
        padding: 0 20px;
      }
      .category-name {
        text-transform: uppercase;
        font-weight: 500;
        font-size: 14px;
        padding-bottom: 5px;
        margin-bottom: 10px;
        border-bottom: 1px solid;
        display: block;
        position: relative;
        cursor: pointer;
        &:after{
          display: none;
          content: "";
          position: absolute;
          top: 50%;
          right: 5px;
          width: 0;
          height: 0;
          @include transform(translate(0,-100%));
          border-left: 3px solid transparent;
          border-right: 3px solid transparent;
          border-top: 5px solid;
          @media (min-width: $br-mobileMap){
            display: block;
          }
        }
        em{
          display: none;
          font-size: 11px;
        }
      }
    }
  }
  // @ul
  .layers {
    &.closed{
      display: none;
    }
    // @li
    .layer {
      width: 100%;
      margin-bottom: 10px;
      @include clearfix();
      &:last-child {
        margin-bottom: 0;
      }

      .layer-name {
        display: block;
        position: relative;
        padding: 0 75px 0 13px;
        font-size: 13px;
        @media (min-width: $br-mobileMap){
          padding: 0 38px 0 13px;
        }
        .circle{
          position: absolute;
          top: -2px;
          left: 0;
        }
        .subtitle {
          font-size: 11px;
          padding: 5px 8px 0 0px;
          display: block;
          color: #AAA;
          word-wrap: break-word;
        }
      }
      .layer-sublayer {
        cursor: pointer;
        padding: 10px 5px 5px 14px;
        position: relative;
        .onoffswitch {
          margin-top: 1px;
        }

        .sublayer-title {
          font-size: 13px;
          margin-left: 5px;
          color: #ccc;
          display: inline-block;
          .source {
            top: 9px;
          }
        }
      }
    }
  }


  // @div
  .source, .layer-close {
    @extend .info-icon;
    display: inline-block;
    position: absolute;
    top: -2px;
    right: 0;

    &.hidden {
      display: none;
    }

    &.text{
      position: relative;
      top: 0;
      width: auto;
      height: auto;
      background: none;
      border: none;
      border-radius: 0;
    }

    &.layer-close{
      right: 17px;
      width: auto;
      background: $white;
      border: 1px solid #AAA;
      padding: 0 5px 0 14px;
      font-size: 9px;
      line-height: 14px;
      border-radius: 14px;
      @media (min-width: $br-mobileMap){
        padding: 0;
        width: 14px;
        border-radius: 50%;
      }
      span{
        display: block;
        color: #AAA;
        @media (min-width: $br-mobileMap){
          display: none;
        }
      }
      &:hover{
        border: 1px solid red;
        span{
          color: red;
        }
        svg{
          fill: red;
        }
      }
      svg{
        left: 2px;
        right: auto;
        fill: #AAA;
        width: 10px;
        height: 10px;
        @include transition(all,0s);
        @media (min-width: $br-mobileMap){
          left: 0;
          right: 0;
        }
      }
    }
  }


  .circle:before {
    content: ' \25CF';
    font-size: 16px;
    margin: 0 4px 0 -1px;
  }

  /*****************/
  /* Layer details */
  /*****************/
  .layer-details {
    margin: 8px 0 0 13px;

    .details-title {
      color: #999;
      font-size: 10px;
      text-transform: uppercase;
      font-weight: 500;
    }

    .layer-colors li {
      margin-bottom: 4px;
      position: relative;
      padding: 0 0 0 14px;
      &:last-child {
        margin-bottom: 0;
      }
      .circle{
        position: absolute;
        top: -2px;
        left: 0;
        &.is-border{
          //text-shadow: 1px 0 0px #000, -1px 0 0px #000, 0px 1px 0px #000, 0px -1px 0px #000;
          text-shadow: 0px 0 1px #000;
        }
      }
      i{
        padding: 0;
        display: block;
        font-style: italic;
        font-size: 11px;
      }
    }

    .canopy {
      width: 190px;
      font-size: 11px;
      line-height: 14px;
      span {
        font-weight: 500;
      }
      .canopy-button{
        background: $cGreen;
        color: $white;
        display: inline-block;
        padding: 1px 5px 0;
        margin: 0 2px;
        border-radius: 10px;
        cursor: pointer;
        box-shadow: 0 0 0 2px $cGreen;
        &:hover{
          background: darken($cGreen,5%);
          box-shadow: 0 0 0 2px darken($cGreen,5%);
        }
      }
    }

    sup {
      vertical-align: top;
      font-size: 0.8em;
    }
  }


  /*****************/
  /* Layer details */
  /*****************/
  .layer-details-loss {
    .canopy{
      margin: 7px 0 0;
      &:first-child{
        margin: 0;
      }
      a{
        background: #AAA;
        width: 12px;
        height: 12px;
        display: inline-block;
        text-align: center;
        color: $white;
        border-radius: 50%;
        font-weight: 500;
        &:hover{
          background: darken(#AAA, 10%);
        }
      }
    }
  }


  /***************************/
  /* Forest2000Layer details */
  /***************************/
  .layer-details-forest2000 {
    .quartiles {
      border: 1px solid #ccc;
      border-radius: 3px;
      margin: 7px 0 5px 0;
      width: 100%;
      height: 23px;
    }

    .quartile {
      background: #4EC54E;
      float: left;
      font-size: 10px;
      color: #fff;
      width: 33.3%;
      @include box-sizing(border-box);
      height: 100%;
      text-align: center;
      padding: 6px 0;
      text-shadow: 0px 0px 2px black;
      &:first-child {background: #9DD89D;}
      &:last-child {background: #00B300;}
    }
  }

  /****************************/
  /* PantropicalLayer details */
  /****************************/
  .layer-details-pantropical {
    .details-title .units {
      font-weight: normal;
      text-transform: normal;
    }

    .total-carbon-bar {
      margin-top: 4px;
    }

    .labels {
      display: block;
      width: 100%;
      height: 12px;
      font-size: 10px;
      li {display: inline-block;}
      li:first-child {float: left;}
      li:last-child {float: right;}
    }

    .quartile-bar {
      clear: both;
      height: 12px;
      width: 100%;
      border: 1px solid #ccc;
      border-radius: 10px;
      background: #FFFFD4;
      background: -moz-linear-gradient(left, #FFFFD4 0%, #dd8653 100%);
      background: -webkit-gradient(linear, left top, right top, color-stop(0%,#FFFFD4), color-stop(100%,#dd8653));
      background: -webkit-linear-gradient(left, #FFFFD4 0%,#dd8653 100%);
      background: -o-linear-gradient(left, #FFFFD4 0%,#dd8653 100%);
      background: -ms-linear-gradient(left, #FFFFD4 0%,#dd8653 100%);
      background: linear-gradient(to right, #FFFFD4 0%,#dd8653 100%);
      filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#FFFFD4', endColorstr='#dd8653', GradientType=1);
      background-image: -ms-linear-gradient(left, #FFFFD4 0%,#dd8653 100%);
    }
  }

  /****************************/
  /* ImazonLayer details */
  /****************************/
  .layer-details-imazon {
    .layer-colors {
      .deforestation {color: #F13689;}
      .degradation {color: #FA98B9;}
      .alerts {
        color: rgb(255, 189, 21);
        &:before {
          content: ' -';
          line-height: 7px;
          font-size: 30px;
          position: relative;
          margin-left: -3px;
          margin-right: 4px;
          top: 5px;
        }
      }
    }
  }

  /****************************/
  /* intactForestLayer2013 details */
  /****************************/
  .layer-details-intact-2013 {
    .layer-colors {
      .intact {color: rgb(22, 133, 0);}
      .degraded {color: rgb(152, 155, 5);}
    }
  }

  /*********************************/
  /* IdnPrimaryLayer details */
  /*********************************/
  .layer-details-idn-primary {
    .layer-colors {
      .intact {color: #007A4D;}
      .degraded {color: #97BD3D;}
    }
  }

  /*********************************/
  /* UserStoriesLayer details */
  /*********************************/
  .layer-details-stories {
    .canopy{
      a{
        color: #f3830a;
        &:hover{
          color: lighten(#f3830a, 10%);
        }
      }
    }
  }

  /****************************/
  /* FiresLayer details */
  /****************************/
  .layer-details-fires {
    a {
      color: #ED4602;
      &:hover{
        color: lighten(#ED4602, 10%);
      }
    }
  }
  .layer-details-grump{
    .canopy{
      margin: 5px 0 0;
    }
  }

  /****************************/
  /* OilPalmLayer details */
  /****************************/
  .layer-details-oil {
    a {
      color: $orange;
      &:hover{
        color: lighten($orange, 10%);
      }
    }
  }
  .layer-details-grump{
    .canopy{
      margin: 5px 0 0;
    }
  }


  /****************************/
  /* HondurasLayer details */
  /****************************/
  .layer-details-honduras-forest {
    .layer-colors li i {
      padding: 4px 0;
    }
  }



}
